package com.gogowan.agroenterprise.widget.adapter;

import android.content.Context;
import android.view.View;
import android.widget.TextView;

import com.gogowan.agroenterprise.R;
import com.gogowan.agroenterprise.base.AbsListAdapter;
import com.gogowan.agroenterprise.base.ViewHolder;
import com.gogowan.agroenterprise.model.BoxCode;

import java.util.List;

/**
 * @Description: LogoManagerAdapter
 * @author mdp
 * @date 2017年1月3日 下午14:10:35
 */
public class HistoryAdapter extends AbsListAdapter<BoxCode> {

	private int type = 0;

	public void setType(int type) {
		this.type = type;
	}

	/**
	 * @param context
	 * @param sourceDatas
	 * @param layoutId
	 */
	public HistoryAdapter(Context context, List<BoxCode> sourceDatas, int layoutId) {
		super(context, sourceDatas, layoutId);
	}

	@Override
	public void convert(int position, ViewHolder holder, BoxCode bean) {
		if (type == 0) {
			((TextView) holder.getView(R.id.fname)).setText("箱码内容");
		} else if (type == 1) {
			((TextView) holder.getView(R.id.fname)).setText("礼盒码内容");
		} else {
			((TextView) holder.getView(R.id.fname)).setText("垛码内容");
			holder.getView(R.id.layout_gg).setVisibility(View.GONE);
			holder.getView(R.id.layout_mc).setVisibility(View.GONE);
		}
		((TextView) holder.getView(R.id.pack_item_cpm_tv)).setText(bean.getCode());
		((TextView) holder.getView(R.id.history_item_mingcheng_tv)).setText(bean.getMaterialName());
		((TextView) holder.getView(R.id.history_item_xinghao_tv)).setText("" + bean.getMaterialSpecication());
		((TextView) holder.getView(R.id.history_item_riqi_tv)).setText("" + bean.getPackDate());
	}
}
